FROM daocloud.io/ubuntu:16.04

MAINTAINER hua.wu

# 环境安装
RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
    && apt update \
    && apt upgrade -y \
    && apt install php7.0 php7.0-dev -y \
    && pecl install redis \
    && echo "extension=redis.so" > /etc/php/7.0/cli/conf.d/20-redis.ini \
    && echo "extension=redis.so" > /etc/php/7.0/fpm/conf.d/20-redis.ini \
    && ln -s /usr/lib/x86_64-linux-gnu/libssl.so  /usr/lib \
    && apt-get install openssl libssl-dev -y \
    && pecl install mongodb \
    && echo "extension=mongodb.so" > /etc/php/7.0/cli/conf.d/20-mongodb.ini \
    && echo "extension=mongodb.so" > /etc/php/7.0/fpm/conf.d/20-mongodb.ini \
    && mkdir /run/php
    ## include=/etc/php/7.0/fpm/pool.d/*.conf
#
RUN { \
   echo '[www]';\
   echo ';prefix = /path/to/pools/\$pool';\
   echo 'user = www-data';\
   echo 'group = www-data';\
   echo ';listen = /run/php/php7.0-fpm.sock';\
   echo 'listen = 9000';\
   echo ';listen.backlog = 511';\
   echo 'listen.owner = www-data';\
   echo 'listen.group = www-data';\
   echo ';listen.mode = 0660';\
   echo ';listen.acl_users =';\
   echo ';listen.acl_groups =';\
   echo ';listen.allowed_clients = 127.0.0.1';\
   echo '; process.priority = -19';\
   echo 'pm = dynamic';\
   echo 'pm.max_children = 5';\
   echo 'pm.start_servers = 2';\
   echo 'pm.min_spare_servers = 1';\
   echo 'pm.max_spare_servers = 3';\
   echo ';pm.process_idle_timeout = 10s;';\
   echo ';pm.max_requests = 500';\
   echo ';pm.status_path = /status';\
   echo ';ping.path = /ping';\
   echo ';ping.response = pong';\
   echo ';access.log = log/\$pool.access.log';\
   echo ';access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"';\
   echo ';slowlog = log/\$pool.log.slow';\
   echo ';request_slowlog_timeout = 0';\
   echo ';request_terminate_timeout = 0';\
   echo ';rlimit_files = 1024';\
   echo ';rlimit_core = 0';\
   echo ';chroot =';\
   echo ';chdir = /var/www';\
   echo ';catch_workers_output = yes';\
   echo ';clear_env = no';\
   echo ';security.limit_extensions = .php .php3 .php4 .php5 .php7';\
   echo ';env[HOSTNAME] = \$HOSTNAME';\
   echo ';env[PATH] = /usr/local/bin:/usr/bin:/bin';\
   echo ';env[TMP] = /tmp';\
   echo ';env[TMPDIR] = /tmp';\
   echo ';env[TEMP] = /tmp';\
   echo ';php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com';\
   echo ';php_flag[display_errors] = off';\
   echo ';php_admin_value[error_log] = /var/log/fpm-php.www.log';\
   echo ';php_admin_flag[log_errors] = on';\
   echo ';php_admin_value[memory_limit] = 32M';\
} | tee > /etc/php/7.0/fpm/pool.d/www.conf

COPY docker-php-entrypoint /usr/local/bin/

ENTRYPOINT ["docker-php-entrypoint"]
#RUN groupadd www
#RUN useradd -g www -s /sbin/nologin -b /var  www

# 开放端口
EXPOSE 9000
# 工作目录
WORKDIR /var/www/html

# 运行命令
CMD [ "php-fpm7.0 && php -a" ]
# CMD["docker-php-entrypoint"]

# docker build -t wolferhua/php:fpm70-ubuntu.0.0.1 .










